Skip to content

add internal git ReadAPI/WriteAPI impl scaffolding + refactor GitBlobstore reads#10414

Merged
coffeegoddd merged 4 commits intomainfrom
db/gitblobstore-next
Feb 4, 2026
Merged

add internal git ReadAPI/WriteAPI impl scaffolding + refactor GitBlobstore reads#10414
coffeegoddd merged 4 commits intomainfrom
db/gitblobstore-next

Conversation

@coffeegoddd
Copy link
Copy Markdown
Contributor

This PR advances the Git-backed blobstore.Blobstore prototype by adding a principled internal git write plumbing layer (still unused by GitBlobstore for now) and refactoring read plumbing into a ReadAPI interface + concrete impl to match the write side.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Git-backed blobstore implementation by introducing a principled layering between the high-level GitBlobstore and low-level git plumbing operations. It adds a WriteAPI implementation (scaffolding for future use) and extracts the existing read functionality into a ReadAPI interface with a concrete implementation.

Changes:

  • Introduced ReadAPI interface and ReadAPIImpl to encapsulate git read operations
  • Added WriteAPI implementation (WriteAPIImpl) with plumbing commands for future write support
  • Extracted OID type definition to a separate file for better organization
  • Refactored GitBlobstore to use ReadAPI instead of calling git functions directly

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
go/store/blobstore/internal/git/write_impl.go New file implementing WriteAPI with git CLI plumbing commands for write operations (read-tree, update-index, write-tree, commit-tree, update-ref)
go/store/blobstore/internal/git/util.go New file with utility functions ReadAllBytes and NormalizeGitPlumbingError
go/store/blobstore/internal/git/read_impl.go New file implementing ReadAPI with all read operations previously in read.go
go/store/blobstore/internal/git/read.go Refactored to define ReadAPI interface instead of standalone functions
go/store/blobstore/internal/git/oid.go New file extracting OID type definition
go/store/blobstore/git_blobstore.go Updated to use ReadAPI interface methods instead of standalone functions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Base automatically changed from db/gitblobstore to main February 4, 2026 19:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +25 to +26
func ReadAllBytes(ctx context.Context, r *Runner, oid OID) ([]byte, error) {
rc, err := NewAPIImpl(r).BlobReader(ctx, oid)
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ReadAllBytes function creates a new APIImpl instance on every call. This could be inefficient if called frequently, as it allocates a new struct each time. Consider accepting an existing GitAPI interface parameter instead of creating a new APIImpl, or accepting a pre-existing APIImpl. This would be more consistent with how other parts of the codebase use the API (e.g., GitBlobstore stores an api field).

Copilot uses AI. Check for mistakes.
@coffeegoddd
Copy link
Copy Markdown
Contributor Author

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
715b783 ok 5937471
version total_tests
715b783 5937471
correctness_percentage
100.0

@coffeegoddd coffeegoddd merged commit 0cce8ac into main Feb 4, 2026
23 of 24 checks passed
@coffeegoddd coffeegoddd deleted the db/gitblobstore-next branch February 4, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants